package com.hellogood.yaohuo.server.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.hellogood.yaohuo.server.db.DBHelper;
import com.hellogood.yaohuo.shared.entity.Size;

public class SizeDAO extends DBHelper {
	Logger log = Logger.getLogger(this.getClass());
	@Override
	public List<?> initializeObject(ResultSet rs) throws SQLException {
		List<Size> list = new ArrayList<Size>();
		if (rs != null) {
			while (rs.next()) {
				Size size = new Size();
				size.setSizeCode(rs.getString("SizeCode"));
				size.setSize1(rs.getString("Size1"));
				size.setSize2(rs.getString("Size2"));
				list.add(size);
			}
		}
		return list;
	}

	@SuppressWarnings("unchecked")
	public List<Size> getAllSize() {
		String sql = "SELECT * FROM CSize ORDER BY size2";
		List<?> list = super.query(sql);
		return (List<Size>) list;
	}
}
